<!--
 * @Description: 资源管理---系统监控
 * @Author: 魏勇
 * @Date: 2020-03-09 15:36:26
 * @LastEditTime: 2020-03-31 18:16:32
 * @LastEditors: 魏勇
 -->
<template>
    <div class="devOpsResource" style="width:100%;height:calc(100% - 48px);">
        <div v-show="msg!==''">{{msg}}</div>
            <iframe :src="iframeSrc"  style="width:100%;height:100%;border:0;"></iframe>
    </div>
</template>

<script>
    import { Loading } from 'element-ui';

    let loadingIns=null;

    export default {
        name: "sysMonitor",
        components: {

        },
        beforeCreate(){
            loadingIns = Loading.service({text:"加载中"});
        },
        computed: {},
        data:function(){
            let sessionId = this.$store.state.user.sessionId;
            return {
                msg:"",
                iframeSrc:""
            }
        },
        created() {

        },
        mounted() {
            this.api.oauthCheck({params: {}}, {method: "get", customRequest: true})
                .then(res => {
                    this.iframeSrc = URL_CONFIG.GRAFANA_URL;
                    //这里如果iframe请求失败才会执行 防止极端情况
                    loadingIns.close();
                })
                .catch(err => {
                    loadingIns.close();
                    this.msg="您无权限访问，请联系管理员"
                });
        },
        watch: {},
        methods: {
        }
    };
</script>

<style lang="scss">


</style>